/**
 * class to store playerinfo
 */
import java.util.Arrays;


/**
 * @author Master
 * @version $Revision: 1.0 $
 */
public class PlayerInfo {
	/**
	 * Field SHI.
	 * (value is 10)
	 */
	private static final int SHI = 10;

	/**
	 * Field LIANGBAI.
	 * (value is 200)
	 */
	private static final int LIANGBAI = 200;

	/**
	 * Field SHIWAN.
	 * (value is 100000)
	 */
	private static final int SHIWAN = 100000;

	/**
	 * Field ERSHI.
	 * (value is 20)
	 */
	private static final int ERSHI = 20;

	/**
	 * Method toString.
	
	 * @return String */
	@Override
	public String toString() {
		return "PlayerInfo []";
	}

	/**
	 * Field insurance.
	 */
	public static boolean InsuranceIns=false;

	/**
	 * Field currentSolarSystem.
	 */
	public static SolarSystem CurrentSolarSystem=null;

	/**
	 * Field destination.
	 */
	/**
	 * Field currentPlanet.
	 */
	public static Planet CurrentPlanet=null, Destination=null;

	/**
	 * Field cnt.
	 */
	/**
	 * Field y.
	 */
	/**
	 * Field x.
	 */
	/**
	 * Field money.
	 */
	public static int Money=0, Xx=0, Yy=0, Cnt=0;

	/**
	 * Field cargoSpaceUsed.
	 */
	public static int CargoSpaceUsed=0;

	/**
	 * Field cargoSpace.
	 */
	public static int CargoSpace=0;

	/**
	 * Field goodOwned.
	 */
	public static int[] GoodOwned=null;

	/**
	 * Field templeKey.
	 */
	public static int TempleKey=0;
    
	/**
	 * Method getDestination.
	
	 * @return Planet */
	public static Planet getDestination() {
		return Destination;
	}

	/**
	 * Method setDestination.
	 * @param destination Planet
	 */
	public static void setDestination(Planet destination) {
		PlayerInfo.Destination = destination;
	}

	/**
	 * Field fuelCapacity.
	 */
	/**
	 * Field fuel.
	 */
	public static int Fuel=0, FuelCapacity=0;

	/**
	 * Field duckKilled.
	 */
	public static int DuckKilled=0;
	
	/**
	 * Constructor for PlayerInfo.
	 */
	public PlayerInfo(){
		InsuranceIns=false;
		CargoSpace=ERSHI;
		CargoSpaceUsed=0;
		Money=SHIWAN;
		GoodOwned=new int[SHI];
		Arrays.fill(GoodOwned, 0);
		Fuel = LIANGBAI;
		FuelCapacity=LIANGBAI;
		TempleKey=0;
	}

	/**
	 * Method getCurrentSolarSystem.
	
	 * @return SolarSystem */
	public static SolarSystem getCurrentSolarSystem() {
		return CurrentSolarSystem;
	}

	/**
	 * Method setCurrentSolarSystem.
	 * @param currentSolarSystem SolarSystem
	 */
	public static void setCurrentSolarSystem(SolarSystem currentSolarSystem) {
		PlayerInfo.CurrentSolarSystem = currentSolarSystem;
	}

	/**
	 * Method getCurrentPlanet.
	
	 * @return Planet */
	public static Planet getCurrentPlanet() {
		return CurrentPlanet;
	}

	/**
	 * Method setCurrentPlanet.
	 * @param currentPlanet Planet
	 */
	public static void setCurrentPlanet(Planet currentPlanet) {
		PlayerInfo.CurrentPlanet = currentPlanet;
	}

	/**
	 * Method getMoney.
	
	 * @return int */
	public static int getMoney() {
		return Money;
	}

	/**
	 * Method setMoney.
	 * @param money int
	 */
	public static void setMoney(int money) {
		PlayerInfo.Money = money;
	}

	/**
	 * Method in.
	 */
	public static void in(){
		CargoSpaceUsed++;
	}

	/**
	 * Method out.
	 */
	public static void out(){
		CargoSpaceUsed--;
	}

	/**
	 * Method buy.
	 * @param goodNo int
	 * @param price int
	 */
	public static void buy(int goodNo, int price){
		GoodOwned[goodNo]++;
		in();
		Money-=price;
	}

	/**
	 * Method sell.
	 * @param goodNo int
	 * @param price int
	 */
	public static void sell(int goodNo, int price){
		GoodOwned[goodNo]--;
		out();
		Money+=price;
	}

	/**
	 * Method getFuel.
	
	 * @return int */
	public static int getFuel(){
		return Fuel;
	}

	/**
	 * Method setFuel.
	 * @param f int
	 */
	public static void setFuel(int f){
		Fuel = f;
	}

	/**
	 * Method getStock.
	 * @param goodNo int
	
	 * @return int */
	public static int getStock(int goodNo){
		return GoodOwned[goodNo];
	}

	/**
	 * Method setStock.
	 * @param goodNo int
	 * @param stock int
	 */
	public static void setStock(int goodNo, int stock){
		GoodOwned[goodNo]=stock;
	}

	/**
	 * Method getCargoAvailable.
	
	 * @return int */
	public static int getCargoAvailable(){
		return CargoSpace - CargoSpaceUsed;
	}

	/**
	 * Method display.
	
	 * @return String */
	public static String display(){
		return "Space Available : " +  (CargoSpace - CargoSpaceUsed) +
				"   Money Left : " + Money;

	}

	/**
	 * Method getCargoSpace.
	
	 * @return int */
	public static int getCargoSpace() {
		return CargoSpace;
	}

	/**
	 * Method setCargoSpace.
	 * @param cargoSpace int
	 */
	public static void setCargoSpace(int cargoSpace) {
		PlayerInfo.CargoSpace = cargoSpace;
	}

	/**
	 * Method getInsurance.
	
	 * @return boolean */
	public static boolean canGetInsurance(){
		return InsuranceIns;
	}
	
	/**
	 * Method setInsurance.
	
	 * @param b boolean
	 */
	public static void setInsurance(boolean b) {
		InsuranceIns=b;
		
	}
}
